program A1 ;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  a, b, i : integer;

begin
  readln(a, b);
  if (b > a) then
    for i:=1 to a do
      begin
      if (a mod i = 0) and (b mod i = 0) then
       writeln(i, ' ');
      end;
     if (a > b) then        
       for i:=1 to b do
       begin
      if (a mod i = 0) and (b mod i = 0) then
       writeln(i, ' ');
       end;

    readln;
end.
 